<template>
  <div class="coopplatform">
    <div class="topbox"></div>
    <div class="bodybox">
      <div class="box1">
        <div class="smallbox">
          <div class="left">
            <img :src="imageURL1" alt="">
          </div>
          <div class="right">
            <p class="p1">官网开户</p>
            <p class="p2">直达官网开户，不接触客户资金</p>
          </div>
        </div>
        <div class="smallbox">
          <div class="left">
            <img :src="imageURL2" alt="">
          </div>
          <div class="right">
            <p class="p1">在线客服</p>
            <p class="p2">专属客服一对一服务，解决开户问题</p>
          </div>
        </div>
        <div class="smallbox" style="margin-left: 20px;">
          <div class="left">
            <img :src="imageURL3" alt="">
          </div>
          <div class="right">
            <p class="p1">合规券商</p>
            <p class="p2">精选持牌合规券商</p>
          </div>
        </div>
      </div>
      <div class="box2">
        <p> &emsp;&emsp; 开户前必读：本网站选择的合作经纪商已经过严格的筛选和审核，具有从事相关行业牌照，
          且受相关机构或部门监管的合法、正规平台。本网站是由合作经纪商授权发布信息的第三方平台，
          并不给您提供交易软件（如MT4/MT5）及交易技术支持，也不对交易资金作任何担保。本网站全程
          不会触碰您在经纪商的任何资金， 更不会参与您的出入金行为，您在合作经纪商平台交易的资金风
          险和使用交易软件存在的风险，本网站概不承担任何法律责任。 若您在开户过程中遇到任何困难，请及时联系客服。</p>
      </div>
      <div class="box3">
        <div class="nav1" >
          <div class="modulebox" v-for="(item, index) in dealer" :key="index">
            <div class="top">
              <div class="topleft">
                <img :src="item.image" alt="">
              </div>
              <div class="topright">
                <p class="p1">{{ item.name }}</p>
                <div class="supervise-container">
                  <p class="p2 supervise-box" style="" v-for="(supervise, index) in item.supervise" :key="index">
                    <span>{{ supervise }}</span>
                  </p>
                </div>

              </div>
            </div>
            <div class="text">
              <div class="content-container" v-html="dealerInfo.content" ref="contentContainer"></div>
              <!-- 其他保留的子元素 -->
            </div>
            <button>前往开户</button>
          </div>

          <div class="modulebox2">
            <div class="bangding">
              <img :src="imageURL8" alt="">
              <p>已有账户，立即绑定</p>
            </div>
          </div>
        </div>
        <!-- <div class="nav2" style="padding-left: 40px;">
         
        </div> -->

      </div>
    </div>
  </div>
</template>
<script>
import { dealerApi, dealerInfoApi } from "@/api/index"

export default {
  name: 'CooperationView',
  data() {
    return {
      dealer: [],
      dealerInfo: {},
      imageURL1: '',
      imageURL2: '',
      imageURL3: '',
      imageURL4: 'https://fxhot.oss-cn-zhangjiakou.aliyuncs.com/jeecgossbizPath/ECMarkets_1677120188291.png',
      imageURL5: 'https://fxhot.oss-cn-zhangjiakou.aliyuncs.com/jeecgossbizPath/1_1677594804063.png',
      imageURL6: 'https://fxhot.oss-cn-zhangjiakou.aliyuncs.com/jeecgossbizPath/1689832879730_1689833481877.png',
      imageURL7: 'https://fxhot.oss-cn-zhangjiakou.aliyuncs.com/jeecgossbizPath/70f1d0cb7e66b6a5c2d3bbb42add2c68_1677120062332.jpg',
      imageURL8: 'http://web.fractaller.club/img/liaojie.4454af2c.png'
    }
  },
  mounted() {
    this.getdealer()
   /*  this.$nextTick(() => {
      this.modifyContentStyle();
    }); */
  },
  methods: {

    getdealer() {
      const token = localStorage.getItem('token');
      let data = {
        token: token,
        page: 1,
        //page_size: 1
      };

      dealerApi(data)
        .then(res => {
          this.dealer = res.data.data;
          console.log(this.dealer);

          const promises = this.dealer.map(item => {
            return this.getdealerInfo(item.id)
              .then(info => {
                item.info = info;
              })
              .catch(error => {
                console.error(error);
              });
          });

          return Promise.all(promises);
        })
        .catch(error => {
          console.error(error);
        });
    },

    getdealerInfo(id) {
      const token = localStorage.getItem('token');
      let data = {
        token: token,
        id: id  // Use the parameter 'id' instead of 'this.id'
      };

      return dealerInfoApi(data)
        .then(res => {
          this.dealerInfo = res.data.data;
          console.log(this.dealerInfo);
          return this.dealerInfo;  // Resolve the promise with dealerInfo
        })
        .catch(error => {
          console.error(error);
          throw error;  // Reject the promise with the error
        });


      this.modifyContentStyle();

    },

   /*  modifyContentStyle() {
      const contentContainer = this.$refs.contentContainer;
      if (contentContainer) {
        contentContainer.style.fontSize = '16px !important';
        contentContainer.style.fontWeight = '100 !important';
      }
    }, */
  }
}
</script>

<style scoped lang="scss">
.supervise-container {
  display: flex;
  border: 1px solid black;
  justify-content: center;
  margin-top: 15px;
  height: 20px;
  text-align: center;
  border-radius: 10px;
}

.supervise-box {
  display: flex;
  align-items: center;
  // margin-right: 10px;
}

.coopplatform {
  width: 100%;

  background-color: #f6f8fa;

  .topbox {
    width: 100%;
    height: 230px;
    background-image: linear-gradient(to bottom, #002748 0%, #002748 30%, #294c69 70%, #294c69 100%);
  }

  .bodybox {
    width: 1200px;
    margin: 0 auto;

    // background-color: pink;
    .box1 {
      width: 1180px;
      margin: 0 auto;
      height: 125px;
      padding-left: 20px;
      padding-right: 10px;
      padding-top: 30px;
      border-radius: 5px;
      background-color: white;
      display: flex;
      justify-content: space-around;
      margin-top: -55px;

      .smallbox {
        width: 33.3%;
        height: 100%;
        background-color: white;
        display: flex;
        border-radius: 20px;
        // padding-top: 30px;
        padding-left: 20px;
        box-sizing: border-box;

        .right {
          margin-left: 20px;
          display: flex;
          flex-direction: column;
          align-items: flex-start;
          flex-wrap: nowrap;
          overflow: hidden;

          .p1 {
            font-size: 23px;
            font-weight: 500;
          }

          .p2 {
            margin-top: 15px;
            font-size: 15px;
            color: gray;
          }
        }
      }
    }

    .box2 {
      width: 1150px;
      height: 130px;

      p {
        width: 100%;
        height: 100px;
        margin-top: 10px;
        font-size: 13px;
        line-height: 20px;
        color: gray;
        text-align: left;
        // background-color: pink;
      }
    }

    .box3 {
      width: 1300px;
      //height: 800px;
      //background-color: skyblue;
      margin-left: -50px;

      .nav1 {
        width: 100%;
        //height: 50%;
        //background-color: pink;
        display: flex;
        justify-content: flex-start;
        flex-wrap: wrap;
        padding-left: 40px;
        padding-right: 20px;

        .modulebox {
          width: 370px;
          height: 320px;
          background-color: white;
          margin-bottom: 100px;
          padding: 10px;
          box-sizing: border-box;
          border-radius: 20px;
          box-shadow: rgba($color: skyblue, $alpha: 0.3) 0px 0px 10px;
          margin-right: 30px;

          .top {
            width: 100%;
            height: 125px;
            display: flex;

            .topleft {
              width: 150px;
              height: 110px;

              img {
                width: 100%;
                height: 100%;
                border-radius: 10px;
              }
            }

            .topright {
              margin-top: 30px;
              margin-left: 40px;

              .p1 {
                font-size: 23px;
                font-weight: 600;
              }

              .p2 {
                font-size: 13px;
                //margin-top: 20px;
                text-align: center;
                padding: 5px;
                //border: 1px solid gray;
                border-radius: 15px;
                // margin-left: 15px;

              }
            }
          }

          .text {
            width: 100%;
            height: 110px;
            // background-color: aquamarine;
            margin-top: 20px;

            .content-container {
              overflow: hidden;
              display: -webkit-box;
              -webkit-line-clamp: 4;
              /* 显示的行数 */
              -webkit-box-orient: vertical;
              text-overflow: ellipsis;
              //color: gray;
              font-weight: 100;
              line-height: 22px;
              text-align: left;
            }

            p {
              overflow: hidden;
              display: -webkit-box;
              -webkit-line-clamp: 4;
              /* 显示的行数 */
              -webkit-box-orient: vertical;
              text-overflow: ellipsis;
              //color: gray;
              font-weight: 100;
              line-height: 22px;
              font-size: 14px;
            }
          }

          button {
            padding-left: 20px;
            padding-right: 20px;
            padding-top: 10px;
            padding-bottom: 10px;
            color: white;
            background-color: #002748;
            border-radius: 5px;
            float: right;
          }
        }

        .modulebox2 {
          width: 370px;
          height: 320px;
          background-color: white;
          padding: 10px;
          box-sizing: border-box;
          border-radius: 20px;
          //margin-left: -20px;
          margin-right: 10px;
          box-shadow: rgba($color: skyblue, $alpha: 0.3) 0px 0px 10px;
          margin-bottom: 100px;

          .bangding {
            width: 100%;
            height: 300px;

            // background-color: pink;
            img {
              width: 250px;
              height: 250px;
            }

            p {
              margin-top: 20px;
              font-weight: 500;
            }
          }
        }
      }

      .nav2 {
        width: 100%;
        height: 50%;
        //background-color: pink;
        display: flex;
        justify-content: flex-start;
        margin-top: 20px;

        .modulebox {
          width: 400px;
          height: 335px;
          background-color: white;
          padding: 10px;
          box-sizing: border-box;
          border-radius: 20px;
          margin-left: 10px;
          margin-right: 10px;
          box-shadow: rgba($color: skyblue, $alpha: 0.3) 0px 0px 10px;

          .top {
            width: 100%;
            height: 125px;
            display: flex;

            .topleft {
              width: 150px;
              height: 110px;

              img {
                width: 100%;
                height: 100%;
              }
            }

            .topright {
              margin-top: 30px;
              margin-left: 50px;

              .p1 {
                font-size: 23px;
                font-weight: 600;
              }

              .p2 {
                font-size: 13px;
                margin-top: 20px;
                padding: 5px;
                border: 1px solid gray;
                border-radius: 15px;
              }
            }
          }

          .text {
            width: 100%;
            height: 130px;
            // background-color: aquamarine;
            margin-top: 30px;
            overflow: hidden;
            display: -webkit-box;
            -webkit-line-clamp: 4;
            /* 显示的行数 */
            -webkit-box-orient: vertical;
            text-overflow: ellipsis;
            //color: gray;
            font-weight: 100;
            line-height: 22px;
            font-size: 14px;

            p {
              overflow: hidden;
              display: -webkit-box;
              -webkit-line-clamp: 4;
              /* 显示的行数 */
              -webkit-box-orient: vertical;
              text-overflow: ellipsis;
              //color: gray;
              font-weight: 100;
              line-height: 22px;
              font-size: 14px;
            }
          }

          button {
            padding-left: 10px;
            padding-right: 10px;
            padding-top: 5px;
            padding-bottom: 5px;
            color: white;
            background-color: #002748;
            border-radius: 5px;
            float: right;
          }
        }

        /* .modulebox {
          width: 370px;
          height: 320px;
          background-color: white;
          padding: 10px;
          box-sizing: border-box;
          border-radius: 20px;
          box-shadow: rgba($color: skyblue, $alpha: 0.3) 0px 0px 10px;

          .top {
            width: 100%;
            height: 125px;
            display: flex;

            .topleft {
              width: 150px;
              height: 110px;

              img {
                width: 100%;
                height: 100%;
                border-radius: 10px;
              }
            }

            .topright {
              margin-top: 30px;
              margin-left: 50px;

              .p1 {
                font-size: 23px;
                font-weight: 600;
              }

              .p2 {
                font-size: 13px;
                margin-top: 20px;
                padding: 5px;
                border: 1px solid gray;
                border-radius: 15px;
              }
            }
          }

          .text {
            width: 100%;
            height: 110px;
            // background-color: aquamarine;
            margin-top: 20px;

            p {
              overflow: hidden;
              display: -webkit-box;
              -webkit-line-clamp: 4;
              -webkit-box-orient: vertical;
              text-overflow: ellipsis;
              font-weight: 100;
              line-height: 22px;
              font-size: 14px;
            }
          }

          button {
            padding-left: 20px;
            padding-right: 20px;
            padding-top: 10px;
            padding-bottom: 10px;
            color: white;
            background-color: #002748;
            border-radius: 5px;
            float: right;
          }
        } */

        .modulebox2 {
          width: 370px;
          height: 320px;
          background-color: white;
          padding: 10px;
          box-sizing: border-box;
          border-radius: 20px;
          margin-left: 10px;
          margin-right: 10px;
          box-shadow: rgba($color: skyblue, $alpha: 0.3) 0px 0px 10px;

          .bangding {
            width: 100%;
            height: 300px;

            // background-color: pink;
            img {
              width: 250px;
              height: 250px;
            }

            p {
              margin-top: 20px;
              font-weight: 500;
            }
          }
        }
      }
    }
  }
}
</style>
